package com.moleq.models;

import com.moleq.db.DatabaseSchema;

public class Receipt {
//	(rm_id integer NOT NULL,
//	rm_type varchar(1) NOT NULL,
//	rm_msg varchar(50) NOT NULL,
//	create_datetime varchar(14) NULL,
//	update_datetime varchar(14) NULL,
//	rm_large varchar(1) NULL;
//	rm_justify varchar(1) NULL;
	private int id;
	private String type;
	private String msg = "";
	private String createTime;
	private String updateTime;
	private String large;
	private String justify;
	private boolean isEdit = false;
	
	public Receipt(){}
	public Receipt(int id,String type,String msg,String large,String justify,String createTime,String updateTime){
		this.id = id;
		this.type = type;
		this.msg = msg;
		this.large = large;
		this.justify = justify;
		this.createTime = createTime;
		this.updateTime = updateTime;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public String getCreateTime() {
		return createTime;
	}
	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}
	public String getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}
	public String getLarge() {
		return large;
	}
	public void setLarge(String large) {
		this.large = large;
	}
	public String getJustify() {
		return justify;
	}
	public void setJustify(String justify) {
		this.justify = justify;
	}
	public boolean isEdit() {
		return isEdit;
	}
	public void setEdit(boolean isEdit) {
		this.isEdit = isEdit;
	}
	public String toMGData(String Action) {
		String Result = Action + "|" + DatabaseSchema.Receipt.SCHEMA_NAME
				+ "|(" + getId() + "," + CheckNull(getType()) + "," + CheckNull(getMsg())
				+ "," + CheckNull(getCreateTime()) + "," + CheckNull(getUpdateTime()) 
				+ "," + CheckNull(getLarge()) + "," + CheckNull(getJustify()) +")";
		return Result;
	}
	
	public String CheckNull(String value){
		if(value == null){
			return null;
		}else{
			return "'" + value + "'";
		}
	}
}
